package spring.demo.mapper;

import org.apache.ibatis.annotations.*;
import spring.demo.bean.User;

import java.util.List;


@Mapper
//@mapper一定要写  不然springboot无法扫描mapper
public interface UserMapper {
        //登陆界面代码
    @Select("select username from user where username=#{username} and password=#{password}")
    String login(@Param("username") String username,@Param("password") String password);

    //查询全部
    @Select("select * from user")
    List<User> findAll();

    //删除
    @Delete("delete from user where id=#{id}")
    int deleteById(int id);

    //增加
    @Insert("insert into user(id,username,password,tname,age) values(#{id},#{username},#{password},#{tname},#{age})")
    int add(User user);
}
